<?php
	$lang_array2 = array();
	$lang_array1 = $treeclass->gettreetypes('lang');
	foreach ($lang_array1 as $value) $lang_array2[$value['name']] = strtolower($value['name']);
	if (isset($_POST['lang'])) $_SESSION['lang']=strtolower($_POST['lang']);
	if (isset($_GET['lang'])) $_SESSION['lang']=strtolower($_GET['lang']);
	if (!(array_key_exists('lang', $_SESSION)) or !(isset($_SESSION['lang'])) or !(in_array($_SESSION['lang'], $lang_array2))) $_SESSION['lang']=$setupdata['default_languages']; 
	$_SESSION['lang'] = strtolower($_SESSION['lang']);
	$lang = $_SESSION['lang'];
?>
